package com.wjp.banquet.common.util;

import com.wjp.banquet.entity.User;


/**
 * @Author 王君平
 * @Date 2023/8/31 10:58
 * @Description
 */
public class UserUtil {

    public static final String USER_INFO = "user_info";

    private static ThreadLocal<User> userLocal = new ThreadLocal<>();

    public static void setUserLoginVO(User user){
        userLocal.set(user);
    }


    public static Integer getCurrentUserId(){
        User user = userLocal.get();
        if(user == null){
            return null;
        }
        return user.getId();
    }

    public static void remove(){
        userLocal.remove();
    }


}
